package com.cloud.system.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cloud.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Size;

/**
 * 字典类型表 sys_dict_type
 *
 * @author zx
 */
@Data
@Schema(name = "字典类型", description = "系统管理")
@TableName("sys_dict_type")
public class SysDictType extends BaseEntity {

    @Excel(name = "主键", orderNum = "1", width = 15)
    @TableId(value = "dict_id", type = IdType.AUTO)
    private Long dictId;

    @Schema(description = "字典名称")
    @Excel(name = "字典名称", orderNum = "2", width = 15)
    private String dictName;

    @Schema(description = "字典类型")
    @Excel(name = "字典类型", orderNum = "3", width = 15)
    private String dictType;

    @Schema(description = "状态 0=正常,1=停用")
    @Excel(name = "状态", orderNum = "4", width = 10, replace = {"正常_0", "停用_1"})
    private Integer status;

    @Schema(description = "备注")
    @Excel(name = "备注", orderNum = "5", width = 20)
    private String remark;

    @NotBlank(message = "字典名称不能为空")
    @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
    public String getDictName() {
        return dictName;
    }

    @NotBlank(message = "字典类型不能为空")
    @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
    public String getDictType() {
        return dictType;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("dictId", getDictId())
                .append("dictName", getDictName())
                .append("dictType", getDictType())
                .append("status", getStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
